package duotai;

class Shape {
    public void draw() {
        System.out.println("画图形！"); }
}
class Rect extends Shape{
    @Override
    public void draw() {
        System.out.println("♦"); }
}
 class Cycle extends Shape{
    @Override
    public void draw() {
        System.out.println("●"); }
}
public class Test {
    public static void main(String[] args) {
        Rect rect=new Rect();
        Cycle cycle=new Cycle();

        Shape[]shapes={rect,cycle,rect,cycle};//利用(foreach 循环），遍历数组shapes中的每个元素。

        for (Shape shape:shapes){
            shape.draw();
        }
    }
}
